
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>yunhoo audit vouchers</title>
    </h:head>
    <h:body>
        <h:form id="stock">
            <rich:panel header="支出类型" styleClass="content-hight">
                <rich:messages globalOnly="true"/>
                <rich:toolbar itemSeparator="grid">
                    <rich:toolbarGroup >
                        <a4j:commandButton value="新增" render="payStyle,errmessage" action="#{payStyleBean.add}" >
                        </a4j:commandButton>
                        <a4j:commandButton value="修改" render="payStyle,errmessage" action="#{payStyleBean.update}" >
                        </a4j:commandButton>
                        <a4j:commandButton value="删除" render="payStyle,payStyleTable,errmessage" action="#{payStyleBean.checkDelete}" >
                        </a4j:commandButton>
                        <a4j:commandButton value="保存" render="payStyle,payStyleTable,errmessage" action="#{payStyleBean.sava}" >
                        </a4j:commandButton>
                        <a4j:commandButton value="取消" render="payStyle,errmessage" action="#{payStyleBean.cancel}" >
                        </a4j:commandButton>
                    </rich:toolbarGroup>
                </rich:toolbar>     

                <h:panelGrid id="payStyle" columns="2">
                    <h:outputText value="代码:"/>
                    <h:inputText  disabled="#{!payStyleBean.editAble}"  value="#{payStyleBean.pay.code}" />
                    <h:outputText value="名称:"/>
                    <h:inputText  disabled="#{!payStyleBean.editAble}"  value="#{payStyleBean.pay.name}" />
                    <h:outputText value="类型:"/>
                    <h:selectOneRadio disabled="#{!payStyleBean.editAble}"  value="#{payStyleBean.pay.type}" >
                            <f:selectItem itemLabel="现金" itemValue="0"/>
                            <f:selectItem itemLabel="非现金" itemValue="1"/>
                     </h:selectOneRadio>
                    <h:outputText value="备注:"/>
                    <h:inputText  disabled="#{!payStyleBean.editAble}"  value="#{payStyleBean.pay.memo}" />
                </h:panelGrid>

                <rich:dataTable id="payStyleTable" value="#{payStyleBean.payModel}"
                                rows="10" var="pay"
                                style=" width: 350px;" >

                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="代码"/>
                            </h:panelGroup>
                        </f:facet>

                        <a4j:commandLink action="#{payStyleBean.getPayStyle}" render="payStyle" >
                            <h:outputText value="#{pay.code}"/>
                        </a4j:commandLink>
                    </rich:column>

                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="名称"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pay.name}"/>
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="类型"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="现金" rendered="#{pay.type == '0'}" />
                        <h:outputText value="非现金" rendered="#{pay.type == '1'}" />
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:outputText value="备注"/>
                            </h:panelGroup>
                        </f:facet>
                        <h:outputText value="#{pay.memo}"/>
                    </rich:column>

                </rich:dataTable>
            </rich:panel>
        </h:form>
    </h:body>
</html>
